 package client.inventory;

 import com.fasterxml.jackson.annotation.JsonTypeInfo;
 import java.io.Serializable;
 import server.MapleItemInformationProvider;


 @JsonTypeInfo(use = JsonTypeInfo.Id.CLASS)
 public class Item
   implements Comparable<Item>, Serializable
 {
   private static final long serialVersionUID = -1063003648432448717L;
   private int id;
   private short position;
   private short quantity;
   private short flag;
/*  17 */   private long expiration = -1L;
/*  18 */   private long inventoryitemid = -1L;
/*  19 */   private FamiliarCard familiarCard = null;
/*  20 */   private MaplePet pet = null;
   private int uniqueid;
/*  22 */   private int equipOnlyId = -1; private int sn;
/*  23 */   private String owner = "";
/*  24 */   private String GameMaster_log = "";
/*  25 */   private String giftFrom = "";
/*  26 */   private int familiarid = 0;



   private short espos;



   public Item(int id, short position, short quantity, short flag, int uniqueid, short espos) {
/*  35 */     this.id = id;
/*  36 */     this.position = position;
/*  37 */     this.quantity = quantity;
/*  38 */     this.flag = flag;
/*  39 */     this.uniqueid = uniqueid;
/*  40 */     this.equipOnlyId = -1;
   }


   public Item(int id, short position, short quantity, short flag) {
/*  45 */     this.id = id;
/*  46 */     this.position = position;
/*  47 */     this.quantity = quantity;
/*  48 */     this.flag = flag;
/*  49 */     this.uniqueid = -1;
/*  50 */     this.equipOnlyId = -1;
   }


   public Item(int id, short position, short quantity) {
/*  55 */     this.id = id;
/*  56 */     this.position = position;
/*  57 */     this.quantity = quantity;
/*  58 */     this.uniqueid = -1;
/*  59 */     this.equipOnlyId = -1;
   }




   public Item copyWithQuantity(short quantitys) {
/*  66 */     Item ret = new Item(this.id, this.position, quantitys, this.flag, this.uniqueid, this.espos);
/*  67 */     ret.pet = this.pet;
/*  68 */     ret.owner = this.owner;
/*  69 */     ret.sn = this.sn;
/*  70 */     ret.GameMaster_log = this.GameMaster_log;
/*  71 */     ret.expiration = this.expiration;
/*  72 */     ret.giftFrom = this.giftFrom;
/*  73 */     ret.equipOnlyId = this.equipOnlyId;
/*  74 */     return ret;
   }

   public Item copy() {
/*  78 */     Item ret = new Item(this.id, this.position, this.quantity, this.flag, this.uniqueid, this.espos);
/*  79 */     ret.pet = this.pet;
/*  80 */     ret.owner = this.owner;
/*  81 */     ret.sn = this.sn;
/*  82 */     ret.GameMaster_log = this.GameMaster_log;
/*  83 */     ret.expiration = this.expiration;
/*  84 */     ret.giftFrom = this.giftFrom;
/*  85 */     ret.equipOnlyId = this.equipOnlyId;
/*  86 */     ret.familiarCard = this.familiarCard;
/*  87 */     ret.familiarid = this.familiarid;
/*  88 */     return ret;
   }

   public int getItemId() {
/*  92 */     return this.id;
   }

   public void setItemId(int id) {
/*  96 */     this.id = id;
   }

   public short getPosition() {
/* 100 */     return this.position;
   }

   public void setPosition(short position) {
/* 104 */     this.position = position;
/* 105 */     if (this.pet != null) {
/* 106 */       this.pet.setInventoryPosition(position);
     }
   }

   public short getFlag() {
/* 111 */     return this.flag;
   }

   public void setFlag(short flag) {
/* 115 */     this.flag = flag;
   }

   public short getQuantity() {
/* 119 */     return this.quantity;
   }

   public void setQuantity(short quantity) {
/* 123 */     this.quantity = quantity;
   }

   public byte getType() {
/* 127 */     return 2;
   }

   public String getOwner() {
/* 131 */     return this.owner;
   }

   public void setOwner(String owner) {
/* 135 */     this.owner = owner;
   }

   public void removeFlag(short flag) {
/* 139 */     this.flag = (short)(this.flag & (flag ^ 0xFFFFFFFF));
   }

   public void addFlag(short flag) {
/* 143 */     this.flag = (short)(this.flag | flag);
   }

   public long getExpiration() {
/* 147 */     return this.expiration;
   }

   public void setExpiration(long expire) {
/* 151 */     this.expiration = expire;
   }

   public String getGMLog() {
/* 155 */     return this.GameMaster_log;
   }

   public void setGMLog(String GameMaster_log) {
/* 159 */     this.GameMaster_log = GameMaster_log;
   }

   public int getUniqueId() {
/* 163 */     return this.uniqueid;
   }

   public void setUniqueId(int ui) {
/* 167 */     this.uniqueid = ui;
   }

   public int getSN() {
/* 171 */     return this.sn;
   }

   public void setSN(int sn) {
/* 175 */     this.sn = sn;
   }

   public int getFamiliarid() {
/* 179 */     return this.familiarid;
   }

   public void setFamiliarid(int familiarid) {
/* 183 */     this.familiarid = familiarid;
   }

   public FamiliarCard getFamiliarCard() {
/* 187 */     return this.familiarCard;
   }

   public void setFamiliarCard(FamiliarCard familiarCard) {
/* 191 */     this.familiarCard = familiarCard;
   }




   public boolean hasSetOnlyId() {
/* 198 */     MapleItemInformationProvider ii = MapleItemInformationProvider.getInstance();
/* 199 */     return (this.uniqueid <= 0 && !ii.isCash(this.id) && this.id / 1000000 == 1 && this.equipOnlyId <= 0);
   }

   public int getEquipOnlyId() {
/* 203 */     return this.equipOnlyId;
   }

   public void setEquipOnlyId(int OnlyId) {
/* 207 */     this.equipOnlyId = OnlyId;
   }

   public long getInventoryId() {
/* 211 */     return this.inventoryitemid;
   }

   public void setInventoryId(long ui) {
/* 215 */     this.inventoryitemid = ui;
   }

   public MaplePet getPet() {
/* 219 */     return this.pet;
   }

   public void setPet(MaplePet pet) {
/* 223 */     this.pet = pet;
/* 224 */     if (pet != null) {
/* 225 */       this.uniqueid = pet.getUniqueId();
     }
   }

   public String getGiftFrom() {
/* 230 */     return this.giftFrom;
   }

   public void setGiftFrom(String gf) {
/* 234 */     this.giftFrom = gf;
   }

   public short getESPos() {
/* 238 */     return this.espos;
   }

   public void setESPos(short espos) {
/* 242 */     this.espos = espos;
   }




   public boolean isSkillSkin() {
/* 249 */     return (this.id / 1000 == 1603);
   }


   public int compareTo(Item other) {
/* 254 */     if (Math.abs(this.position) < Math.abs(other.getPosition()))
/* 255 */       return -1; 
/* 256 */     if (Math.abs(this.position) == Math.abs(other.getPosition())) {
/* 257 */       return 0;
     }
/* 259 */     return 1;
   }



   public boolean equals(Object obj) {
/* 265 */     if (!(obj instanceof Item)) {
/* 266 */       return false;
     }
/* 268 */     Item ite = (Item)obj;
/* 269 */     return (this.uniqueid == ite.getUniqueId() && this.id == ite.getItemId() && this.quantity == ite.getQuantity() && Math.abs(this.position) == Math.abs(ite.getPosition()));
   }


   public String toString() {
/* 274 */     return "物品: " + this.id + " 数量: " + this.quantity;
   }

   public Item() {}
 }


/* Location:              C:\PGX\Server.jar!\client\inventory\Item.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */